package com.secondGroup.mapper;

import com.secondGroup.entity.VirtualBankCard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ybk
 * @since 2022-05-05
 */
@Mapper
public interface VirtualBankCardMapper extends BaseMapper<VirtualBankCard> {
    @Select("select id from t_virtual_bank_card where c_id=#{cid}")
    @Results({
            @Result(column = "c_id",property = "cid")
    })
    VirtualBankCard selectinfo(@Param("cid") String cid);
    @Select("select id from t_virtual_bank_card where c_id = #{cid} and id_number = #{idNumber}")
    @Results({
            @Result(column = "c_id",property = "cid"),
            @Result(column = "id_number",property = "idNumber")
    })
    VirtualBankCard selectverification(String cid, String idNumber);


    @Select("Select c_id,bank from t_virtual_bank_card where c_id in (select c_id from t_bank_card where account = #{account})")
    @Results({
            @Result(column = "account",property = "account")
    })
    List<VirtualBankCard> findAll(String account);

    @Select("SELECT c_id,bank,abalance,pay_password FROM t_virtual_bank_card WHERE c_id = #{cId}")
    VirtualBankCard selectVirtualBank(String cId);

}
